package org.info.stock.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.info.stock.entity.LatestStocks;
import org.info.stock.mapper.LatestStocksMapper;
import org.info.stock.utils.commonutils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class LatestController {
    @Autowired
    private LatestStocksMapper latestStocksMapper;

    @RequestMapping(value = "/Command/selectLatest",method = RequestMethod.GET)
    public R selectLatest(){
        QueryWrapper<LatestStocks> objectQueryWrapper = new QueryWrapper<>();
        QueryWrapper<LatestStocks> code = objectQueryWrapper.eq("code", 600009);
        LatestStocks latestStocks = latestStocksMapper.selectOne(code);
        return R.ok().data("name",latestStocks.getName());
    }
}
